package com.estore;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

public class ProductSorters {
    public static Comparator<Product> BY_PRICE_ASC=new Comparator<Product>(){
        @Override
        public int compare(Product o1, Product o2) {
            return Double.compare(o1.getPrice(),o2.getPrice());
        }
    };
    public static Comparator<Product> BY_PRICE_DESC=(o1, o2) -> Double.compare(o2.getPrice(),o1.getPrice());
    public static Comparator<Product> BY_STOCK_DESC=(o1, o2) -> Integer.compare(o2.getStock(),o2.getStock());
}
